﻿@model IEnumerable<MyShopCity.Models.Commodity>

@{
    ViewBag.Title = "欢迎";
}
@if (Model.Count()==0)
{
    @Html.ActionLink("添加商品","CreateCommodity")
}
else 
{   
    <table class="table">
        <tr>
            <th>商品名称</th>
            <th>价格</th>
            <th>单位</th>
            <th>图像</th>
            <th>状态</th>
            <th>描述</th>
            <th>操作</th>
        </tr>
    @foreach (var item in Model) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.CommodityName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Price)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CommodityUnit)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ImageUrl)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Status)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Description)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
                @Html.ActionLink("Details", "Details", new { id=item.ID }) |
                @Html.ActionLink("Delete", "Delete", new { id=item.ID })
            </td>
        </tr>
    }

    </table>
}